package heven.holt.eyepetizer.repository

import androidx.paging.Pager
import androidx.paging.PagingConfig
import heven.holt.eyepetizer.api.ApiMainPageService
import heven.holt.eyepetizer.paging.CommendPagingSource
import javax.inject.Inject

class MainPageRepository @Inject constructor(
    private val apiMainPageService: ApiMainPageService
) {
    companion object {
        private const val PAGE_SIZE = 20
    }

    fun getHomePageRecommendPagingData() =
        Pager(
            config = PagingConfig(
                initialLoadSize = 10,
                prefetchDistance = 5,
                enablePlaceholders = false,
                pageSize = PAGE_SIZE
            )
        ) {
            CommendPagingSource(apiMainPageService)
        }.flow
}